import { makeAutoObservable } from 'mobx';
import * as Icons from '@ant-design/icons';

// 定义菜单项接口
interface MenuItem {
  key: string;
  label: string;
  path: string;
  icon?: string;
  children?: MenuItem[];
}

class MenuStore {
  // 菜单主题
  theme: 'light' | 'dark' = 'dark';
  items: MenuItem[] = [
    { key: 'document', label: '文件写作', path: '/document', icon: 'FileOutlined' },
    { key: 'ai-assistant', label: '工作助手', path: '/ai-assistant', icon: 'RobotOutlined' },
    /*{ key: 'offices', label: '公文助手', path: '/offices', icon: 'AppstoreOutlined' },*/
    { key: 'docArchive', label: '知识库', path: '/docArchive', icon: 'BookOutlined' },
    { key: 'settings', label: '个人设置', path: '/settings', icon: 'SettingOutlined' },
  ];

  items_engine: MenuItem[] = [
    { key: 'dashboard', label: '基本信息', path: '/engine/dashboard', icon: 'InfoCircleOutlined' },
    {
      key: 'common',
      label: '通用设置',
      path: '/engine/common',
      icon: 'SettingOutlined',
      children: [
        { key: 'common-user', label: '用户设置', path: '/engine/common/user', icon: 'UserOutlined' },
        { key: 'common-role', label: '角色设置', path: '/engine/common/role', icon: 'TeamOutlined' },
        { key: 'common-permission', label: '权限设置', path: '/engine/common/permission', icon: 'LockOutlined' },
        { key: 'common-menu', label: '菜单设置', path: '/engine/common/menu', icon: 'AppstoreOutlined' },
      ]
    },
    { key: 'model', label: '模型设置', path: '/engine/model', icon: 'DatabaseOutlined' },
    { key: 'prompt', label: '提示词设置', path: '/engine/prompt', icon: 'BulbOutlined' },
    
    { key: 'function', label: '函数设置', path: '/engine/function', icon: 'CodeOutlined' },
    { key: 'agent', label: '智能体设置', path: '/engine/agent', icon: 'RobotOutlined' },
    // { key: 'workflow', label: 'AI工作流', path: '/engine/workflow', icon: 'DeploymentUnitOutlined' },
    { key: 'visualize', label: '数据监控', path: '/engine/visualize', icon: 'BarChartOutlined' },
    
    { key: 'scene', label: '智能场景设置', path: '/engine/scene', icon: 'AppstoreOutlined' },
    { key: 'directory', label: '文件目录管理', path: '/engine/directory', icon: 'FolderOpenOutlined' },

    { key: 'vector', label: '向量知识库设置', path: '/engine/vector', icon: 'DatabaseOutlined' },
    { key: 'filemgr', label: '文件管理', path: '/engine/filemgr', icon: 'FileOutlined' },
  ];

  constructor() {
    makeAutoObservable(this);
  }

  // 动态添加菜单项
  addMenuItemEngine(item: MenuItem) {
    this.items_engine.push(item);
  }

  // 根据key移除菜单项
  removeMenuItemEngine(key: string) {
    this.items_engine = this.items_engine.filter(item => item.key !== key);
  }


  // 动态添加菜单项
  addMenuItem(item: MenuItem) {
    this.items.push(item);
  }

  // 根据key移除菜单项
  removeMenuItem(key: string) {
    this.items = this.items.filter(item => item.key !== key);
  }

  // 设置菜单主题
  setTheme(theme: 'light' | 'dark') {
    this.theme = theme;
  }
}

export const menuStore = new MenuStore(); 